package com.huiyeji.dynamic.core.provider;

import com.huiyeji.dynamic.core.DynamicContext;
import com.huiyeji.dynamic.core.DynamicStatement;

public class StatementParamProvider extends AbstractParamProvider {

    private DynamicStatement dynamicStatementWrapper;

    public StatementParamProvider(String paramName) {
        super(paramName);
    }

    public void parseWrapper(DynamicContext context){
        this.dynamicStatementWrapper = context.getParserMatcher().matchObject(getParamName()).parse(context,getParamName());
    }

    @Override
    public Object get(DynamicContext context, String paramName) {
        return context.getExecutor().execute(context,dynamicStatementWrapper);
    }
}
